-- Use CAST
USE AdventureWorks2008;
GO
SELECT SUBSTRING(Name, 1, 30) AS ProductName, ListPrice
FROM Production.Product
WHERE CAST(ListPrice AS int) LIKE '3%';
GO

-- Use CONVERT.
USE AdventureWorks2008;
GO
SELECT SUBSTRING(Name, 1, 30) AS ProductName, ListPrice
FROM Production.Product
WHERE CONVERT(int, ListPrice) LIKE '3%';
GO

-- Use CAST to perform concatenation
USE AdventureWorks2008;
GO
SELECT 'The list price is ' + CAST(ListPrice AS varchar(12)) AS ListPrice
FROM Production.Product
WHERE ListPrice BETWEEN 350.00 AND 400.00;
GO

-- USE CAST and CONVERT with datetime data
SELECT 
   '2008-04-25T15:50:59.997' AS UnconvertedText,
   CAST('2008-04-25T15:50:59.997' AS datetime) AS UsingCast,
   CONVERT(datetime, '2008-04-25T15:50:59.997', 126) AS UsingConvertFrom_ISO8601 ;
GO